<template>
  <div class="account-settings-info-view">
    <div class="title">开放服务设置</div>
    <a-form-model layout="vertical" style="max-width: 320px;margin-top: 12px">
      <a-form-model-item label="访问凭据" extra="该自定义凭据用于访问平台的开放服务，例如：微信报警API等，其他开放服务请查询官方文档。">
        <a-input placeholder="请输入访问凭据" v-model="settings.api_key"/>
      </a-form-model-item>
      <a-form-model-item>
        <a-button type="primary" @click="submitKetInfo">保存设置</a-button>
      </a-form-model-item>
    </a-form-model>
  </div>
</template>

<script>
  import * as api from '@/api/system/settingManage'
  import { mapGetters } from 'vuex'

  export default {
    computed: {
      ...mapGetters(['settings'])
    },
    methods: {
      submitKetInfo() {
        const dataList = [
          { key: 'api_key', value: this.settings.api_key },
        ]
        api.addObj({ data: dataList }).then((res) => {
          if (res.success) {
            this.$message.success('保存成功！')
          } else {
            this.$message.error(res.message)
          }
        })
      }
    }
  }
</script>

<style lang="less" scoped>
</style>

